﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Bzure.Common.Core;
using Bzure.Common.Data;

namespace Bzure.Common.Data
{
    public static class EntityExtensions
    {
        public static void Update<T>(this T entity, string ProviderName) where T : TemplateEntity
        {
            EntityPostRequest request = Actor.Public.BuildEntityPostProcessor(ProviderName).ToUpdateRequest(entity);
            Actor.Public.BuildEntityProcessor(ProviderName).UpdateEntity(request);
        }
        public static void Delete<T>(this T entity, string ProviderName) where T : TemplateEntity
        {
            EntityPostRequest request = Actor.Public.BuildEntityPostProcessor(ProviderName).ToDeleteRequest(entity);
            Actor.Public.BuildEntityProcessor(ProviderName).UpdateEntity(request);
        }
    }
}
